/*
 * GUIObjectFactory.cpp
 *
 *  Created on: 09/11/2009
 *      Author: marcos
 */

#include "GUIObjectFactory.h"

#include "gui/objects/intersections/GUIAvenueIntersection.h"
#include "gui/objects/intersections/GUIHighwayIntersection.h"
#include "gui/objects/intersections/GUIIntersection.h"
#include "gui/objects/intersections/GUIRouteIntersection.h"
#include "gui/objects/intersections/GUIStreetIntersection.h"
#include "gui/objects/locations/GUIHospital.h"
#include "gui/objects/locations/GUIHotel.h"
#include "gui/objects/locations/GUISchool.h"
#include "gui/objects/locations/GUIMapLocation.h"
#include "gui/objects/locations/GUIPoliceStation.h"
#include "gui/objects/locations/GUIRestaurant.h"
#include "gui/objects/locations/GUIUnknownLocation.h"
#include "gui/objects/segments/GUIAvenueSegment.h"
#include "gui/objects/segments/GUIBaseSegment.h"
#include "gui/objects/segments/GUIHighwaySegment.h"
#include "gui/objects/segments/GUIStreetSegment.h"
#include "gui/objects/segments/GUIRoadArrow.h"
#include "gui/objects/segments/GUIRoadSegment.h"
#include "gui/objects/segments/GUIRouteSegment.h"
#include "gui/objects/segments/GUIRouteArrow.h"

namespace gui {

GUIObjectFactory::GUIObjectFactory() {}

GUIObjectFactory::~GUIObjectFactory() {}

GUIObject* GUIObjectFactory::createGUIMapLocation(MapLocation* mapLocation){
	GUIObject* guiMapLocation = NULL;
	switch (mapLocation->getType()) {
		case Hotel: guiMapLocation = new GUIHotel(mapLocation); break;
		case School: guiMapLocation = new GUISchool(mapLocation); break;
		case Hospital: guiMapLocation = new GUIHospital(mapLocation); break;
		case Restaurant: guiMapLocation = new GUIRestaurant(mapLocation); break;
		case PoliceStation: guiMapLocation = new GUIPoliceStation(mapLocation); break;
		default: guiMapLocation = new GUIUnknownLocation(mapLocation);
	}
	return guiMapLocation;
}

GUIObject* GUIObjectFactory::createGUIBaseSegment(RoadSegment* roadSegment){
	return new GUIBaseSegment(roadSegment);
}

GUIObject* GUIObjectFactory::createGUIRoadSegment(RoadSegment* roadSegment){
	GUIObject* guiRoadSegment = NULL;
	switch (roadSegment->getRoad()->getRoadType()) {
		case Avenue: guiRoadSegment = new GUIAvenueSegment(roadSegment); break;
		case Highway: guiRoadSegment = new GUIHighwaySegment(roadSegment); break;
		default: guiRoadSegment = new GUIStreetSegment(roadSegment); break;
	}
	return guiRoadSegment;
}

GUIObject* GUIObjectFactory::createGUIRoadArrow(RoadSegment* roadSegment){
	return new GUIRoadArrow(roadSegment);
}

GUIObject* GUIObjectFactory::createGUIRouteSegment(Intersection* origin, Intersection* destination, double width){
	return new GUIRouteSegment(width, origin, destination);
}

GUIObject* GUIObjectFactory::createGUIRouteArrow(Intersection* origin, Intersection* destination, double width){
	return new GUIRouteArrow(width, origin, destination);
}

GUIObject* GUIObjectFactory::createGUIIntersection(Intersection* intersection, RoadType type){
	GUIObject* guiIntersection = NULL;
	switch (type) {
		case Highway: guiIntersection = new GUIHighwayIntersection(intersection); break;
		case Avenue: guiIntersection = new GUIAvenueIntersection(intersection); break;
		default: guiIntersection = new GUIStreetIntersection(intersection); break;
	}
	return guiIntersection;
}

GUIObject* GUIObjectFactory::createGUIRouteIntersection(Intersection* intersection){
	return new GUIRouteIntersection(intersection);
}

}
